package com.neusoft.my12306.controller;


import com.neusoft.my12306.common.res.CommonResult;
import com.neusoft.my12306.entity.Orders;
import com.neusoft.my12306.entity.Ticket;
import com.neusoft.my12306.service.IOrdersService;
import com.neusoft.my12306.service.ITicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 葛彬
 * @since 2023-07-22
 */
@CrossOrigin
@RestController
@RequestMapping("/orders")
public class OrdersController {


    @Autowired
    IOrdersService ordersService;

    @PostMapping("/add")
    public CommonResult addOrders(@RequestBody Orders orders) {
        return ordersService.addOrders(orders);
    }

    @PostMapping("/query")
    public CommonResult queryOrders(@RequestParam String name) {
        return ordersService.queryOrders(name);
    }

    @PostMapping("/mod")
    public CommonResult payOrders(@RequestParam Integer oid,@RequestParam String paytime) {
        return ordersService.payOrders(oid,paytime);
    }

    @PostMapping("/queryticket")
    public CommonResult queryMyTicket(@RequestParam String name) {
        return ordersService.queryMyTicket(name);
    }

}
